// 首页
// http://118.195.252.190:9094

// 登录
// http://118.195.252.190:9094/#/pages/passport/login

// 接单
// http://118.195.252.190:7076/member/buyerTaskAdvances/grab



let token = Android.getMap("token")
localStorage.setItem("token", token)


function getAndroidToken() {
    let token = localStorage.getItem("token")
    return token
}
getAndroidToken()


function getParameterHandler() {
    let timestamp = new Date().getTime()
    let m = `appKey=15f4200c968b1e0a&shopCateId=4&timestamp=${timestamp}&key=31593886409a3f86804a12ec9e4ff176`
    let sign = md5Utils.md5(m)
    let strUrl = `?shopCateId=1&timestamp=${timestamp}&sign=${sign}`
    let url = parameter.getMap("url") + strUrl
    let headers = {
        "Authorization": parameter.getMap("token")
    }
    let body = {}
    return {
        mediaType: "json",
        requestType: "POST",
        url: url,
        headers: JSON.stringify(headers),
        body: JSON.stringify(body)
    }
}
getParameterHandler()



function getResponse() {
    let res = response.getMap("res")
    res = JSON.parse(res)
    let code = "500"
    let message = res["message"]
    let dataKey = ""
    let dataValue = ""
    if (res["code"] == 200) {
        code = "200"
        message = "接单成功，请尽快完成"
    } else if (res["code"] == 401) {
        code = "500"
    }else{
        code = "300"
    }
    return {
        code: code,
        message: message,
        dataKey: dataKey,
        dataValue: dataValue
    }
}
getResponse()


// {"code":501,"message":"正在为您匹配任务, 请勿重复点击","now":1724840108445}